<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
   
</head>

<body>
  <div>
    <div><input type="text" id="username"  placeholder="用户名"/></div>
    <div><input type="password" id="password" placeholder="请输入密码" /></div>
    <div><button onclick="kfDoLogin()">客服登录</button></div>
  </div>
  
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/1.3.6/axios.js"></script>
<script src="js/qs.js"></script>
<script>
  function kfDoLogin(){
    let username = $("#username").val()
    let password = $("#password").val()
    axios.post("/kfDoLogin",{username,password}).then(e=>{
        console.log(e)
        alert(e.codeInfo)
        if(e.code==200){
            localStorage.setItem("token",e.token)
            localStorage.setItem("userinfo",JSON.stringify(e.userinfo))
            location.href="/chat"
        }
    })
  }
</script>

</html>